<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    let s = "Hello,world"
    console.log('字符串长度：',s.length)
    console.log('第2-4个字符',s.slice(1,4))
    console.log('第1-4个字符',s.slice(0,4))
    console.log('最后3个字符',s.slice(-3))
    console.log('前3个字符',s.slice(0,3))
    console.log('最后1个字符',s.slice(-1))
    console.log('最后1个字符',s.slice(0))
</script>
</html>